
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
public class LoginDemo extends JFrame {
    private final Component maddle;
    private final JPanel bottom;

    public LoginDemo(String s) {
        super(s); //    Frame(s)
        BorderLayout b = new BorderLayout();
        this.getContentPane().setLayout(b);
        
        
        JLabel title = new JLabel("登录窗体",JLabel.CENTER);
        this.getContentPane().add("North",title);
       
        panel middle = new panel();
       middle.setLayout(new GridLayout(2,2));
        JLabel label1 = new JLabel("输入用户名",JLabel.RIGHT);
        JLabel label2 = new JLabel("输入密码",JLabel.RIGHT);
        JTextField text1 = new JTextField();
        JTextField text2 =new   JTextField();
        middle.add(label1);
        middle.add(text1);
        middle.add(label2);
        middle.add(text2);
        this.getContentPane().add("North",title);
        
        JPanel bottom = new JPanel();
        bottom.setLayout(new FlowLayout(FlowLayout.CENTER));
        Button b1 = new Button("提交");
        Button b2 = new Button("清除");
        bottom.add(b1);
        bottom.add(b2);
        this.getContentPane().add("South",bottom);
        
        this.pack();
        
        
        
    }
    public static void main(String[] args) {
        LoginDemo tes = new LoginDemo("登录");
 //  test.show();
        test.setVisible(true);
        
    }

}
